#!/bin/bash

TESTNAMES=`ls dt/test_*.dt`
cd $BINDIR
for testname in $TESTNAMES
do
	testname=`basename $testname`
	# compiling
	mkdir -p ../tmp
	java frontend/Compiler -d ../tmp --data-path ../userdata/datapath ../$DTDIR/$testname
	
	FILENAMES=`ls ../tmp/*.java`
	# testing
	for f in $FILENAMES
	do
		f=`basename $f`
		cmd="diff ../answers/$testname/$f ../tmp/$f"
		echo -n "Test $f of $testname"
		if $cmd > /dev/null
		then
			echo "....OK!"
		else
			echo "....FAIL!!!!"
		fi
	done
	# clean up the tmp folder
	rm -rf ../tmp
done
